xend: support multiple consoles per domain
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 16 Jun 2009 10:25:37 +0000 (11:25 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 16 Jun 2009 10:25:37 +0000 (11:25 +0100)
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
stubdom/stubdom-dm
tools/python/xen/xend/XendConfig.py
tools/python/xen/xend/image.py
tools/python/xen/xm/create.py

index be39fff8940d7355d4b42be6e0d062fa35830db6..956c1dbd9c3b91079a9788c3f21d77278af3236d 100644 (file)
@@ -52,6 +52,10 @@ do
                 keymap=$2
                 shift
                 ;;
+           -serial)
+               serial="$2"
+               shift
+               ;;
        esac
     fi
     case "$1" in
@@ -100,6 +104,7 @@ test $vnc != 0 && vfb="$vfb, vnc=$vnc, vncdisplay=$vnc_port, vnclisten=$ip, vncu
 vncpasswd=`xenstore-read /local/domain/0/backend/vfb/$domid/0/vncpasswd 2>/dev/null`
 test "$vncpasswd" && vfb="$vfb, vncpasswd=$vncpasswd"
 test "$keymap" && vfb="$vfb, keymap=$keymap"
+test "$serial" && vfb="$vfb, serial=$serial"
 echo "vfb = ['$vfb']" >> /etc/xen/stubdoms/$domname-dm
 
 echo -n "disk = [ " >> /etc/xen/stubdoms/$domname-dm
index 87bb3721e093cfad9971508aa0cbca5473b40418..fd5dc6f9eb282164e85af117b45bd205419346c6 100644 (file)
@@ -1432,6 +1432,16 @@ class XendConfig(dict):
                    del dev_info['type']
                    log.debug("iwj dev_type=%s vfb setting dev_info['%s']" %
                                (dev_type, vfb_type))
+                if dev_info.get('serial') is not None :
+                    # Create two serial backends now, the location value is bogus, but does not matter
+                    cfg = self.console_add('vt100', '0')
+                    c_uuid = uuid.createString()
+                    target['devices'][c_uuid] = ('console', cfg)
+                    target['console_refs'].append(c_uuid)
+                    cfg = self.console_add('vt100', '1')
+                    c_uuid = uuid.createString()
+                    target['devices'][c_uuid] = ('console', cfg)
+                    target['console_refs'].append(c_uuid)
                 
             elif dev_type == 'console':
                 if 'console_refs' not in target:
index 8364df30b72194ebde0c4bcd5a7853831b79cec2..a398f694d3102fc282930b31758c49dfb1d01003 100644 (file)
@@ -286,6 +286,9 @@ class ImageHandler:
             if dev_type == 'vfb':
                 if 'keymap' in dev_info:
                     keymap = dev_info.get('keymap',{})
+                if 'serial' in dev_info:
+                    ret.append("-serial")
+                    ret.append(dev_info.get('serial',{}))
                 if int(dev_info.get('vnc', 0)) != 0 :
                     has_vnc = True
                 if int(dev_info.get('sdl', 0)) != 0 :
@@ -746,12 +749,10 @@ class HVMImageHandler(ImageHandler):
 
         if not self.display :
             self.display = ''
-        # Do not store sdl, opengl and serial related qemu cli options
+        # Do not store sdl and opengl qemu cli options
         self.vm.storeVm(("image/dmargs", " ".join([ x for x in self.dmargs
                         if x != "-sdl"
-                        and x != "-disable-opengl"
-                        and x != "-serial"
-                        and x != "pty" ])),
+                        and x != "-disable-opengl" ])),
                         ("image/device-model", self.device_model),
                         ("image/display", self.display))
         self.vm.permissionsVm("image/dmargs", { 'dom': self.vm.getDomid(), 'read': True } )
index a36371aab56acc5c135d9756c08f3c4eb0b0c6c5..2d96e4aa82900b579813bc98684eb617ac2a2c6b 100644 (file)
@@ -352,7 +352,7 @@ gopts.var('irq', val='IRQ',
          For example 'irq=7'.
          This option may be repeated to add more than one IRQ.""")
 
-gopts.var('vfb', val="vnc=1,sdl=1,vncunused=1,vncdisplay=N,vnclisten=ADDR,display=DISPLAY,xauthority=XAUTHORITY,vncpasswd=PASSWORD,opengl=1,keymap=FILE",
+gopts.var('vfb', val="vnc=1,sdl=1,vncunused=1,vncdisplay=N,vnclisten=ADDR,display=DISPLAY,xauthority=XAUTHORITY,vncpasswd=PASSWORD,opengl=1,keymap=FILE,serial=FILE",
           fn=append_value, default=[],
           use="""Make the domain a framebuffer backend.
           Both sdl=1 and vnc=1 can be enabled at the same time.
@@ -364,7 +364,8 @@ gopts.var('vfb', val="vnc=1,sdl=1,vncunused=1,vncdisplay=N,vnclisten=ADDR,displa
           For sdl=1, a viewer will be started automatically using the
           given DISPLAY and XAUTHORITY, which default to the current user's
           ones.  OpenGL will be used by default unless opengl is set to 0.
-          keymap overrides the XendD configured default layout file.""")
+          keymap overrides the XendD configured default layout file.
+         Serial adds a second serial support to qemu.""")
 
 gopts.var('vif', val="type=TYPE,mac=MAC,bridge=BRIDGE,ip=IPADDR,script=SCRIPT," + \
           "backend=DOM,vifname=NAME,rate=RATE,model=MODEL,accel=ACCEL",
@@ -827,7 +828,7 @@ def configure_vfbs(config_devs, vals):
         for (k,v) in d.iteritems():
             if not k in [ 'vnclisten', 'vncunused', 'vncdisplay', 'display',
                           'videoram', 'xauthority', 'sdl', 'vnc', 'vncpasswd',
-                          'opengl', 'keymap' ]:
+                          'opengl', 'keymap', 'serial' ]:
                 err("configuration option %s unknown to vfbs" % k)
             config.append([k,v])
         if not d.has_key("keymap"):